package com.gome.ocean.common.utils;

public class JdbcUtils {

    public static String getMysqlJdbcUrl(String ip, String port, String schema) {
        return new StringBuilder().append("jdbc:mysql://")
            .append(ip)
            .append(":")
            .append(port)
            .append("/")
            .append(schema)
                .append("?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull")
            .toString();
    }

    public static String getOracleJdbcUrl(String ip, String port, String schema) {
        return new StringBuilder().append("jdbc:oracle:thin:@")
            .append(ip)
            .append(":")
            .append(port)
            .append(":")
            .append(schema)
            .toString();
    }

    public static String getOracleJdbcUrl2(String ip, String port, String serviceName) {
        return new StringBuilder().append("jdbc:oracle:thin:@")
            .append(ip)
            .append(":")
            .append(port)
            .append("/")
            .append(serviceName)
            .toString();
    }
}
